package com.lrkj.payfee.controller;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lrkj.common.annotation.Log;
import com.lrkj.common.core.controller.BaseController;
import com.lrkj.common.core.domain.AjaxResult;
import com.lrkj.common.enums.BusinessType;
import com.lrkj.payfee.domain.AdvicePaymentMode;
import com.lrkj.payfee.service.IAdvicePaymentModeService;
import com.lrkj.common.utils.poi.ExcelUtil;
import com.lrkj.common.core.page.TableDataInfo;

/**
 * 付款方式记录Controller
 *
 * @author yajun_ren
 * @date 2022-03-26
 */
@RestController
@RequestMapping("/payfee/advicePaymentMode")
@Api(tags = "付款方式记录")
public class AdvicePaymentModeController extends BaseController
{
    @Autowired
    private IAdvicePaymentModeService advicePaymentModeService;

    /**
     * 查询付款方式记录列表
     */
    @ApiOperation(value = "查询付款方式记录列表", notes = "查询付款方式记录列表")
    @PreAuthorize("@ss.hasPermi('payfee:advicePaymentMode:list')")
    @GetMapping("/list")
    public TableDataInfo list(AdvicePaymentMode advicePaymentMode)
    {
        startPage();
        this.changeParameter(advicePaymentMode.getParams());
        List<AdvicePaymentMode> list = advicePaymentModeService.selectAdvicePaymentModeList(advicePaymentMode);
        return getDataTable(list);
    }

    /**
     * 导出付款方式记录列表
     */
	@ApiOperation(value = "导出付款方式记录列表", notes = "导出付款方式记录列表")
    @PreAuthorize("@ss.hasPermi('payfee:advicePaymentMode:export')")
    @Log(title = "付款方式记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(AdvicePaymentMode advicePaymentMode)
    {
        List<AdvicePaymentMode> list = advicePaymentModeService.selectAdvicePaymentModeList(advicePaymentMode);
        ExcelUtil<AdvicePaymentMode> util = new ExcelUtil<AdvicePaymentMode>(AdvicePaymentMode.class);
        return util.exportExcel(list, "付款方式记录数据");
    }

    /**
     * 获取付款方式记录详细信息
     */
	@ApiOperation(value = "获取付款方式记录详细信息", notes = "获取付款方式记录详细信息")
    @PreAuthorize("@ss.hasPermi('payfee:advicePaymentMode:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(advicePaymentModeService.selectAdvicePaymentModeById(id));
    }

    /**
     * 新增付款方式记录
     */
    @ApiOperation(value = "新增付款方式记录", notes = "新增付款方式记录")
    @PreAuthorize("@ss.hasPermi('payfee:advicePaymentMode:add')")
    @Log(title = "付款方式记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AdvicePaymentMode advicePaymentMode)
    {
        return toAjax(advicePaymentModeService.insertAdvicePaymentMode(advicePaymentMode));
    }

    /**
     * 修改付款方式记录
     */
    @ApiOperation(value = "修改付款方式记录", notes = "修改付款方式记录")
    @PreAuthorize("@ss.hasPermi('payfee:advicePaymentMode:edit')")
    @Log(title = "付款方式记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AdvicePaymentMode advicePaymentMode)
    {
        return toAjax(advicePaymentModeService.updateAdvicePaymentMode(advicePaymentMode));
    }

    /**
     * 删除付款方式记录
     */
    @ApiOperation(value = "删除付款方式记录", notes = "删除付款方式记录")
    @PreAuthorize("@ss.hasPermi('payfee:advicePaymentMode:remove')")
    @Log(title = "付款方式记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(advicePaymentModeService.deleteAdvicePaymentModeByIds(ids));
    }
}
